package 实现类.作业;

import java.util.Calendar;
import java.util.Scanner;

public class zuoye8 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("请输入年份");
        int year=input.nextInt();
        System.out.println("请输入月份");
        int month=input.nextInt();
        Calendar cal=Calendar.getInstance();
        cal.set(year,month,0);
        int days=cal.get(Calendar.DAY_OF_MONTH);
        System.out.println(days);
        cal.set(year,month-1,1);
        int dayOfWeek=cal.get(Calendar.DAY_OF_WEEK)-1;
        System.out.println("日历表");
        System.out.println("日\t一\t二\t三\t四\t五\t六");
        for (int i=0;i<dayOfWeek;i++){
            System.out.print("\t");
        }
        for (int i=1;i<=days;i++){
            System.out.print(i);
            cal.set(year,month-1,i);
            if (cal.get(Calendar.DAY_OF_WEEK)==7){
                System.out.println();
            }else {
                System.out.print("\t");
            }
        }
    }


}
